package io.web.api.controller;

import io.web.vo.HelloVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("hello")
@Slf4j
public class HelloApi {

    @PostMapping("/h1")
    public Map<String, Object> hello1(@RequestBody HelloVo helloVo) {
        log.info("==> get data from api interface = {}", helloVo);
        Map<String, Object> res = new HashMap<>();
        res.put("status", 0);
        res.put("data", "h1接口响应内容: " + helloVo.getMessage());
        return res;
    }

    @PostMapping("/h2")
    public Map<String, Object> hello2(@RequestBody HelloVo helloVo) {
        log.info("==> get data from api interface = {}", helloVo);
        Map<String, Object> res = new HashMap<>();
        res.put("status", 0);
        res.put("data", "h2接口响应内容: " + helloVo.getMessage());
        return res;
    }

    @PostMapping("/h3")
    public Map<String, Object> hello3(@RequestBody HelloVo helloVo) {
        log.info("==> get data from api interface = {}", helloVo);
        Map<String, Object> res = new HashMap<>();
        res.put("status", 0);
        res.put("data", "h3接口响应内容: " + helloVo.getMessage());
        return res;
    }

    @PostMapping("/h4")
    public Map<String, Object> hello4(@RequestBody HelloVo helloVo) {
        log.info("==> get data from api interface = {}", helloVo);
        Map<String, Object> res = new HashMap<>();
        res.put("status", 0);
        res.put("data", "h4接口响应内容: " + helloVo.getMessage());
        return res;
    }

    @PostMapping("/h5")
    public Map<String, Object> hello5(@RequestBody HelloVo helloVo) {
        log.info("==> get data from api interface = {}", helloVo);
        Map<String, Object> res = new HashMap<>();
        res.put("status", 0);
        res.put("data", "h5接口响应内容: " + helloVo.getMessage());
        return res;
    }

    @PostMapping("/h6")
    public Map<String, Object> hello6(@RequestBody HelloVo helloVo) {
        log.info("==> get data from api interface = {}", helloVo);
        Map<String, Object> res = new HashMap<>();
        res.put("status", 0);
        res.put("data", "h6接口响应内容: " + helloVo.getMessage());
        return res;
    }
}
